<!-- 头部 -->
<!DOCTYPE html>
<html lang="zh-cn">

<head>

    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>危废智能监管平台</title>
    <meta name="description" content="index"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="/bootstrap/bootstrap.min.css"/>
    <link rel="stylesheet" href="/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/chosen/chosen.min.css"/>

    <!-- ace styles -->
    <link rel="stylesheet" href="/ace/css/ace.min.css" id="main-ace-style"/>

    <link rel="stylesheet" href="/ace/css/ace-skins.min.css"/>
    <link rel="stylesheet" href="/ace/css/ace-rtl.min.css"/>

    <link rel="stylesheet" href="/ztree/metro.css"/>
    <link rel="stylesheet" href="/validate/css/validform.css"/>
    <link rel="stylesheet" href="/css/custom.css"/>


    <script src="/jquery/jquery.js"></script>

    <!-- ace settings handler -->
    <script src="/ace/js/ace-extra.min.js"></script>
    <!--日期插件-->
    <script type="text/javascript" src="/js/jedate/jedate.js"></script>
    <style>
        #profile .center > label {
            width: 100px;
            text-align: right;
        }
    </style>
</head>

<body class="no-skin" id="body-content">

<!-- 顶部条 -->
<div id="navbar" class="navbar navbar-default">

</div>
<!-- 主体 -->
<div class="main-container" id="main-container">

    <div id="sidebar" class="sidebar responsive">

    </div>


    <div class="main-content">
        <div class="breadcrumbs" id="breadcrumbs">


            <ul class="tab" id="breadcrumb">
                <!-- <li class="active" >
               菜单配置<i class="fa fa-times close"></i>
               </li>  -->
            </ul><!-- /.breadcrumb -->
            <div id="tab-menu">
                <ul class="dropdown-menu dropdown-caret" style="min-width: 0px;">
                    <li><a href="javascript:void(0);" data-right-menu="all_close">全部关闭</a></li>
                    <li><a href="javascript:void(0);" data-right-menu="other_close">关闭其他</a></li>
                </ul>
            </div>
        </div>

        <div class="page-content">
            <div class="ace-settings-container" id="ace-settings-container">
                <div class="btn btn-app btn-xs btn-warning ace-settings-btn"
                     id="ace-settings-btn">
                    <i class="ace-icon fa fa-cog bigger-150"></i>
                </div>

                <div class="ace-settings-box clearfix" id="ace-settings-box">
                    <div class="pull-left width-50">
                        <div class="ace-settings-item">
                            <div class="pull-left">
                                <select id="skin-colorpicker" class="hide">
                                    <option data-skin="no-skin" value="#438EB9">#438EB9</option>
                                    <option data-skin="skin-1" value="#222A2D">#222A2D</option>
                                    <option data-skin="skin-2" value="#C6487E">#C6487E</option>
                                    <option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
                                </select>
                            </div>
                            <span>&nbsp; 皮肤</span>
                        </div>

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-navbar"/> <label class="lbl"
                                                                     for="ace-settings-navbar"> 固定页头</label>
                        </div>

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-sidebar"/> <label class="lbl"
                                                                      for="ace-settings-sidebar"> 固定导航菜单</label>
                        </div>

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-breadcrumbs"/> <label class="lbl"
                                                                          for="ace-settings-breadcrumbs"> 固定导航条</label>
                        </div>

                        <!-- <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                id="ace-settings-rtl" /> <label class="lbl" for="ace-settings-rtl">
                                Right To Left (rtl)</label>
                        </div> -->

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-add-container"/> <label class="lbl"
                                                                            for="ace-settings-add-container"> 固定宽度
                        </label>
                        </div>
                    </div>
                    <!-- /.pull-left -->

                    <div class="pull-left width-50">
                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-hover"/> <label class="lbl"
                                                                    for="ace-settings-hover"> 滑动式菜单</label>
                        </div>

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-compact"/> <label class="lbl"
                                                                      for="ace-settings-compact"> 紧凑式菜单</label>
                        </div>

                        <div class="ace-settings-item">
                            <input type="checkbox" class="ace ace-checkbox-2"
                                   id="ace-settings-highlight"/> <label class="lbl"
                                                                        for="ace-settings-highlight"> 高亮选中</label>
                        </div>
                    </div>
                    <!-- /.pull-left -->
                </div>
                <!-- /.ace-settings-box -->
            </div>
            <!-- /.ace-settings-container -->
            <div class="page-header">
                <h1> 法律法规 </h1>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div id="fill-main-content" style="height: 100%;"><!-- ueditor所需引入 -->


                        <div class="tabbable">
                            <ul class="nav nav-tabs" id="myTab">
                                <li class="active">
                                    <a data-toggle="tab" href="#home">
                                        <i class="green ace-icon fa fa-users bigger-120"></i> 法规列表
                                    </a>
                                </li>
                                <li class=""><a data-toggle="tab" href="#profile">
                                    <i class="green ace-icon fa fa-plus bigger-120"></i> 法规添加
                                </a></li>
                            </ul>
                            <div class="tab-content">
                                <div id="home" class="tab-pane active clearfix">
                                    <div class="widget-container-col ui-sortable">
                                        <div class="widget-box ">
                                            <div class="widget-header widget-header-small">
                                                <h6 class="widget-title">
                                                    <i class="ace-icon fa fa-search"></i>搜索
                                                </h6>

                                                <div class="widget-toolbar">
                                                    <a href="javascript:void(0);" data-action="collapse">
                                                        <i class="ace-icon fa bigger-125 fa-chevron-up"></i>
                                                    </a>
                                                </div>
                                            </div>

                                            <div class="widget-body">
                                                <div class="widget-body-inner">
                                                    <div class="widget-main">
                                                        <form action="statute/list" method="post" id="search-form"
                                                              target="list-page" class="center clearfix">
                                                            <div class="row padding-tb-10">
                                                                <div class="col-sm-6">
                                                                    <label class="inline">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</label>
                                                                    <select name="type" class="width-80" v-model="type">
                                                                        <option value="">请选择区域</option>
                                                                        <option value="1">国家</option>
                                                                        <option value="2">地方</option>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="padding-trb-10 col-sm-12">
                                                                <span class="btn  btn-primary btn-sm col-sm-6"
                                                                      onclick="">全 部 </span>
                                                                <span class="btn btn-info btn-sm col-sm-6"
                                                                      id="search-btn" @click="select(1,pageInfo.size)">条 件 查 询</span>
                                                            </div>
                                                        </form>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div id="list-page">
                                        <table class="table table-striped table-bordered table-hover nomargin-bottom">
                                            <thead>
                                            <tr>
                                                <th class="center">编号</th>
                                                <th class="center">类型</th>
                                                <th class="center">标题</th>
                                                <th class="center">发布时间</th>
                                                <th class="center">来源</th>
                                                <th class="center">操作</th>
                                            </tr>
                                            </thead>

                                            <tbody>
                                            <tr v-for="statute in pageInfo.records">
                                                <td class="center">{{statute.id}}</td>
                                                <td class="center">
                                                    {{statute.type==1?'国家':'地区'}}
                                                </td>
                                                <td class="center">{{statute.title}}</td>
                                                <td class="center">{{statute.pubDate}}</td>
                                                <td class="center">{{statute.stemFrom}}</td>
                                                <td class="center">
                                                    <div class="hidden-sm hidden-xs action-buttons">
                                                        <a class="green" @click="toUpdate(statute.id)">
                                                            <!--onclick="$('#updateModal').modal('show')"-->

                                                            <i class="ace-icon fa fa-pencil bigger-130"></i>
                                                        </a>

                                                        <a class="red" href="javascript:void(0);"
                                                           @click="doDelete(statute.id)">
                                                            <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>

                                            </tbody>
                                        </table>
                                        <div class="space-8"></div>
                                        <div class="clearfix">
                                            <div style="float: left;">
                                                <div style="padding-top:5px;">
			<span class="badge badge-info">
				当前第 {{pageInfo.current}} 页 / {{pageInfo.pages}} 页，共 {{pageInfo.total}} 条数据
			</span>
                                                </div>
                                            </div>
                                            <div>
                                                <div class="pagination no-margin pull-right clearfix">
                                                    <li class="prev "><a href="javascript:void(0);"
                                                                         @click="select(1,pageInfo.size)">首页</a></li>
                                                    <li v-if="pageInfo.hasPreviousPage" class="prev"><a
                                                            href="javascript:void(0);"
                                                            @click="select(pageInfo.prePage,pageInfo.size)">上一页</a></li>
                                                    <li v-else-if="!pageInfo.hasPreviousPage" class="prev disabled"><a>上一页</a>
                                                    </li>
                                                    <li :class="pageInfo.current==i?'active':''"
                                                        v-for="i in pageInfo.navigatepageNums"><a
                                                            href="javascript:void(0);" @click="select(i,pageInfo.size)">{{i}}</a>
                                                    </li>
                                                    <li v-if="pageInfo.hasNextPage" class="next"><a
                                                            href="javascript:void(0);"
                                                            @click="select(pageInfo.nextPage,pageInfo.size)">下一页</a>
                                                    </li>
                                                    <li v-else-if="!pageInfo.hasNextPage" class="next disabled">
                                                        <a>下一页</a></li>
                                                    <li class="next "><a href="javascript:void(0);"
                                                                         @click="select(pageInfo.pages,pageInfo.size)">尾页</a>
                                                    </li>
                                                </div>

                                            </div>
                                        </div>

                                    </div>
                                </div>

                                <div id="profile" class="tab-pane">
                                    <form action="#" method="post" id="statute-save-form">
                                        <div class="align-left padding-10">
                                            <label>标题：</label>
                                            <input type="text" class="width-80" name="title" datatype="*"
                                                   nullmsg="请输入标题"/>
                                        </div>
                                        <div class="align-left padding-10">
                                            <label>类型：</label>
                                            <select name="type" class="width-80" datatype="*" nullmsg="请选择类型">
                                                <option value="1" selected>国家</option>
                                                <option value="2">地区</option>
                                            </select>
                                        </div>
                                        <div class="align-left padding-10">
                                            <label>发布时间：</label>
                                            <input id="indate" type="text" class="width-80" name="pubDate" datatype="*"
                                                   nullmsg="请输入发布时间" placeholder="YYYY-MM-DD" readonly/>

                                        </div>
                                        <div class="align-left padding-10">
                                            <label>来源：</label>
                                            <input type="text" class="width-80" name="stemFrom" datatype="*"
                                                   nullmsg="请输入来源"/>
                                        </div>
                                        <div class="align-left padding-10">
                                            <div style="float:left; text-align: right;"><label
                                                    style="width:50px;">内容：</label></div>
                                            <div class="width-80" style="height:500px;float:left;">
                                                <script id="container" name="description" type="text/plain" datatype="*"
                                                        nullmsg="请输入内容"></script>
                                            </div>
                                            <div class="clearfix"></div>

                                        </div>
                                        <div class="margin-t15">
                                            <span class="btn btn-info btn-block bigger-120"
                                                  id="statute-save-btn">保 存</span>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>


                    </div>

                </div>
            </div>
        </div><!-- /.page-content -->

    </div><!-- /.main-content -->

    <a href="javascript:void(0);" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse" style="z-index:1111">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

<!-- 底部 -->
<!-- basic scripts -->
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8"
        src="/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    jeDate({
        dateCell: '#indate',
        isinitVal: true,
        format: 'YYYY-MM-DD'
    });
</script>
<!-- 实例化编辑器 -->
<!--<script type="text/javascript">

    var ue1 = UE.getEditor("container");


</script>-->
<script>
    try {
        ace.settings.check('main-container', 'fixed')
    } catch (e) {
    }
    try {
        ace.settings.check('navbar', 'fixed')
    } catch (e) {
    }
    try {
        ace.settings.check('sidebar', 'fixed')
    } catch (e) {
    }
    try {
        ace.settings.check('sidebar', 'collapsed')
    } catch (e) {
    }
    try {
        ace.settings.check('breadcrumbs', 'fixed')
    } catch (e) {
    }
    $(function () {
        /*jquery的load方法，异步请求访问后台，通过PageController的三级路径module3方法跳转到对应页面，返回页面放入到对应div中*/
        $("#navbar").load("/manager/common/navbar.html");
        $("#sidebar").load("/manager/common/sidebar.html");
    });
</script>


<script src="/bootstrap/bootstrap.min.js"></script>

<!-- ace scripts -->
<script src="/ace/js/ace-elements.min.js"></script>
<script src="/ace/js/ace.min.js"></script>

<!-- 引入其他js -->
<script src="/js/history.js"></script>
<script type="text/javascript" src="/layer/layer.js"></script>
<script type="text/javascript" src="/js/spin.min.js"></script>
<script type="text/javascript" src="/ztree/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/js/jquery.autosize.min.js"></script>
<script type="text/javascript" src="/chosen/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/validate/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/bootstrap-contextmenu.js"></script>
<script type="text/javascript" src="/js/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="/js/public.js"></script>

<script type="text/javascript" src="/vue/vue.js"></script>
<script type="text/javascript" src="/vue/axios.js"></script>
<script type="text/javascript" src="/js/statute/statute-update.js"></script>
<script>
    new Vue({
        el: '.main-content',
        data: {
            pageInfo: {
                current: 1,
                size: 5
            },//接受后台页对象
            type: '',
            statute: ''
        },
        methods: {
            select: function (pageNum, pageSize) {
                //分页查询返回信息放入pageInfo
                //分页查询返回信息放入pageInfo
                axios({
                    url: `/manager/statute/select/${pageNum}/${pageSize}`,
                    params: {type: this.type}
                }).then(response => {
                    // console.log(response);
                    this.pageInfo = response.data.data;
                }).catch(error => {
                    layer.msg(error.message);
                })
            },
            toUpdate: function (status_id) {
                axios({
                    url: '/manager/statute/selectOne',
                    params: {id: status_id}
                }).then(response => {
                    if (response.data.code == 500) {
                        layer.msg(response.data.msg)
                        return;
                    }
                    // console.log(response.data);
                    //返回数据，绑定到当前父窗口layer的obj上，传递给子窗口
                    //对一些实时性要求不高的数据更新，可以不查询数据，直接方法传参对象，传递到layer子窗口
                    layer.obj = response.data.data;
                    // console.log(layer);
                    let index = layer.open({
                        type: 2,
                        title: '更新statute',
                        content: '/manager/statute/statute-update.html',
                        area: ['60%', '80%'],
                        end: () => {//将上下文中的this传递到end的回调函数中
                            //刷新页面数据
                            this.select(this.pageInfo.current, this.pageInfo.size);
                        }
                    });
                })
            },
            doDelete: function (sid) {
                alert(sid);
            }
        },
        created: function () {
            this.select(1, this.pageInfo.size);
        }
    });
</script>

</body>
</html>
